<html>
<head>
    <script>
        WebAssembly.compile(new Uint8Array(`
  00 61 73 6d   01 00 00 00   01 0c 02 60   02 7f 7f 01
  7f 60 01 7f   01 7f 03 03   02 00 01 07   10 02 03 61
  64 64 00 00   06 73 71 75   61 72 65 00   01 0a 13 02
  08 00 20 00   20 01 6a 0f   0b 08 00 20   00 20 00 6c
  0f 0b`.trim().split(/[\s\r\n]+/g).map(str => parseInt(str, 16))
)).then(module => {
  const instance = new WebAssembly.Instance(module)
//使用 WebAssembly.Instance 将模块对象转成 WebAssembly 实例
  const { add, square } = instance.exports
//通过 instance.exports 可以拿到 wasm 代码输出的接口
  document.write('2 + 4 =', add(2, 4))
  document.write('3^2 =', square(3))
  document.write('(2 + 5)^2 =', square(add(2 + 5)))
})
        </script>
</head>
</html>